package jfae.core.properties.parsers;

import java.beans.BeanInfo;
import java.beans.PropertyDescriptor;

/**
 * Base interface for properties parsing purpose.
 * If you need to extends parsing system this is a good entry point.
 * Define 2 useful methods for accept and elaborate properties
 * @author bobpuley
 *
 * @param <T>
 */
public interface PropertyHandler<T>{
	
	/**
	 * Allow class to refuse elaboration of certain
	 * property, typically you don't want parse the
	 * class prop (because any class have <code>getClass()</code> method)
	 * @param prop the property to accept or not
	 * @param info the bean info of enclosing class
	 * @return true if the prop need parsing
	 */
	boolean accept(PropertyDescriptor prop, BeanInfo info);
	
	/**
	 * Parse property and wrap them into a T object
	 * @param prop the parsing property
	 * @return the wrapped property
	 */
	T parse(PropertyDescriptor prop);
}

